package backend;

import java.io.File;
import java.io.IOException;
/**
 * This is the class the launches the applications.
 * @author Itai Raccah
 *
 */
public class ProgramLauncher {
	/**
	 * Execute the path
	 * @param path - a specified system path.
	 */
	public static void launch(String path){
		System.out.println(path);
		File launchFile = new File(path);
		try {
			String[] cmd = {"cmd.exe", "/c", "start", "\"ShortcutUtilityLauncher\"", launchFile.getPath()};
			Runtime.getRuntime().exec(cmd, null);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	public static void launch(File file){
		try {
			String[] cmd = {"cmd.exe", "/c", "start", "\"ShortcutUtilityLauncher\"", file.getPath()};
			Runtime.getRuntime().exec(cmd, null);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	//Test
	public static void main (String [] args){
		ProgramLauncher.launch("E:/Poet/Arena Deathmatch/Arena DeathMatch_public_72dpi.pdf");
	}
}
